exports.install = (Vue, options) => {
  /**时间格式转换 */
   Vue.prototype.timestampToTime = (timestamp,formatter) => {
     let date = new Date(timestamp);
      let year = date.getFullYear();
      let month = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1);
      let D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate());
      let hours = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours());
      let minutes = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes());
      let seconds = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
      switch (formatter){
        case "yy-mm-dd":
        return `${year}-${month}-${D}`
        case "yy-mm-dd hh:mm:ss":
        return `${year}-${month}-${D} ${hours}:${minutes}:${seconds}`
        case "hh:mm:ss":
        return `${hours}:${minutes}:${seconds}`
        case "yyyy-mm-dd hh:mm:ss":
        return  `${year}-${month}-${D} ${hours}:${minutes}:${seconds}`
        default:
        return `${year}-${month}-${D} ${hours}:${minutes}:${seconds}`
      }
   }
  /*
   * table
   * 表格统一样式
   * */
  /* 表格中男女 */
  Vue.prototype.formatSex = (row, column, cellValue, index) => {
    return cellValue == 1 ? '男' : (cellValue == 2 ? '女' : '');
  };

  /* 表格中认证方式  */
  Vue.prototype.formatterAuthMethod = (row, column, cellValue, index) => {
    return cellValue == 0 ? '人工认证' : (cellValue == 1 ? '人脸识别' : (cellValue == 2 ? '指纹认证' : ""));
  };

  /* 表格中体检结果  */
  Vue.prototype.formatterBodyCheckResult = (row, column, cellValue, index) => {
    return cellValue == 0 ? '合格' : (cellValue == 1 ? '不合格' : "");
  };

  /* 表格中记录状态  */
  Vue.prototype.formatterRecodeStatus = (row, column, cellValue, index) => {
    return cellValue == 0 ? '已处理' : (cellValue == 1 ? '待处理' : "");
  };

  /* 表格中记录状态  */
  Vue.prototype.formatterIsRecode = (row, column, cellValue, index) => {
    return cellValue == 1 ? '已处理' : (cellValue == 0 ? '待处理' : "");
  };


  /* 表格中是或者否  */
  Vue.prototype.formatterIsTrain = (row, column, cellValue, index) => {
    return cellValue == 1 ? '合格' : (cellValue == 0 ? '不合格' : "");
  };
  /*
   * editor
   * 富文本
   * */
  Vue.prototype.onEditorFocus = (event) => {
    event.enable(false);
  };
  /*
   * 打印
   * */
  Vue.prototype.PrintData = () => {
    let printHtml = document.getElementById("printData").innerHTML;
    let wind = window.open("", 'newwindow', 'height=2000, width=2000, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no');
    wind.document.body.innerHTML = printHtml;
    wind.print();
    wind.window.document.body.innerHTML = '';
  };
};
